# skip exercise 6 due to long running time (run it manually)
SURNAME := tremurici
MTRNR := 11907086
EXERCISES := $(foreach i, $(shell seq 1 5) $(shell seq 7 8), exercise$i)

all: $(EXERCISES)

report:
	pandoc report.md -V fontsize:12pt -V geometry:"top=2cm, bottom=2cm" -o report.pdf

exercise%: exercise%.smt2
	z3 $< | tee $@.out

exercise6: exercise6.py
	python exercise6.py | tee $@.out

exercise8: exercise8.py
	python exercise8.py | tee $@.out

submission: $(EXERCISES) report
	rm -f $(SURNAME)-$(MTRNR).zip
	$(foreach i, $(shell seq 1 5) 7, cp exercise$i.smt2 $(SURNAME)-$(MTRNR)-$i-input.txt;)
	$(foreach i, 6 8, cp exercise$i.py $(SURNAME)-$(MTRNR)-$i-input.txt;)
	$(foreach i, $(shell seq 1 5) 7 8, cp exercise$i.out $(SURNAME)-$(MTRNR)-$i-output.txt;)
	mv report.pdf $(SURNAME)-$(MTRNR).pdf
	zip -r $(SURNAME)-$(MTRNR).zip $(SURNAME)-$(MTRNR)*

clean:
	rm -f *.out *.txt *.zip *.pdf

.PHONY: all submission report
